/**
 * Created by lx on 2017/10/16.
 */
angular.module('tableMedia.filter', [])
    .filter('chargestatusFilter', [function () {
        return function (input) {
            if (input == 0)
                return "未充电";
            if (input == 1)
                return "正在充电";
        }
    }])
    .filter('tablestatusFilter', [function () {
        return function (input) {
            if (input == 0)
                return "空置";
            if (input == 1)
                return "预定";
            if (input == 3)
                return "就餐";
            if (input == 4)
                return "呼叫";
            if (input == 6)
                return "离线";
        }
    }])
    .filter('stautusFiter', [function () {
        return function (input) {
            if (input == 1)
                return "启用";
            if (input == 2)
                return "故障";
            if (input == 3)
                return "在线";
            if (input == 4)
                return "掉线";
            if (input == 7)
                return "";
        }
    }])

    .filter('mytimeFilter', [function () {
        return function (input) {
            var newdate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(input)[0];
            return newdate;
        }
    }])
    .filter('repairFilter', [function () {
        return function (status) {
            if (status == 0) return "待接单";
            if (status == 1) return "已接单";
            if (status == 2) return "待评价";
            if (status == 3) return "待评价";
            if (status == 4) return "已评价";
            if (status == 5) return "已取消";
            else return "未知状态";
        }
    }])
    .filter('ele_statusFilter', [function () {
        return function (input) {
            if (input == 0)
                return "低电量";
            if (input == 1)
                return "";
        }
    }])
    .filter('ele_Filter', [function () {
        return function (input) {
            if (input == "低电量")
                return "";
            if (input == "呼叫")
                return "呼叫";
            if (input == "结账")
                return "结账";
        }
    }])
    .filter('time_filter',[function () {
        return function (input) {
            input = input+"";
            return input.substring(0,4)+"-"+input.substring(4,6)+"-"+input.substring(6,8);
        }
    }])
    .filter('time_filter_month',[function () {
        return function (input) {
            input = input+"";
            return input.substring(0,4)+"-"+input.substring(4,6);
        }
    }])